import { inject, provide } from 'vue';
import { configMap, ProjectList, Config } from './config';

const INJECT_KEY = '$PROJECT_NAME';

export const useProject = (): Config => {
  const projectName = inject<ProjectList>(INJECT_KEY);
  return configMap[projectName as ProjectList];
};

export const useProjectInit = (name: ProjectList) => {
  provide(INJECT_KEY, name);
};
